﻿<html >
<head>
    <title>Control collection example</title>
    <script type="text/javascript" src="../dhtiny.js"></script>
    <script type="text/javascript" src="../util/collection.js"></script>
    <script type="text/javascript" src="../util/controlCollection.js"></script>
</head>
<body> <!-- *background="webtop/images/backgroundcorner.gif"-->
<script type="text/javascript">
    $dh.Main = function() {
        //test1D();
        //test2D();
    }

    function test1D() {
        var c1 = $dh.$new(DHCollection, []);
        c1.addItem("aa");
        c1.addItem("cc");
        alert("we have " + c1.toStr("|"));

        c1.addItem("bb", 1);
        alert("after add bb to 1 we have: " + c1.toStr("|"));

        c1.removeItem("aa");
        alert("after remove aa: " + c1.toStr("|"));
        alert("cc now is at: " + c1.getItemIndex("cc"));

        c1.clearItems();
        alert("after clear all items: length=" + c1.items.length + " " + c1.toStr(","));
    }

    function test2D() {
        var c2 = $dh.$new(DH2DCollection, [3,3]);
        c2.addItem("a1");
        c2.addItem("a2");
        c2.addItem("b2", 1, 1);
        c2.addItem("a3");
        c2.addItem("b1");
        c2.addItem("c3",2,2);
        alert("see rows:\n" + c2.items[0] + "\n" + c2.items[1] + "\n" + c2.items[2]);
    }

    function testControlCollection() {
        var cc = $dh.$new(DHControlCollection, []);
        
    }
</script>
</body>
</html>